package com.zhike.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: zhike
 * @CreateTime: 2024/5/1
 * @Description:
 */
public class FormUtils{
        public static Map getDeail(List<Map> avgTypeToday, String name, String id) {
            String columns="[{\n" +
                    "        \"name\":"+ "\""+name+"\",\n" +
                    "        \"id\": "+"\""+id+"\"\n" +
                    "      },\n" +
                    "      {\n" +
                    "        \"name\": \"告警次数\",\n" +
                    "        \"id\": \"alarm_count\"\n" +
                    "      },\n" +
                    "      {\n" +
                    "        \"name\": \"一级告警次数\",\n" +
                    "        \"id\": \"alarm_count_l1\"\n" +
                    "      },\n" +
                    "      {\n" +
                    "        \"name\": \"二级告警次数\",\n" +
                    "        \"id\": \"alarm_count_l2\"\n" +
                    "      },\n" +
                    "      {\n" +
                    "        \"name\": \"三级告警次数\",\n" +
                    "        \"id\": \"alarm_count_l3\"\n" +
                    "      }]";
            JSONArray jsonArray = JSON.parseArray(columns);
            Map data = new HashMap();
            data.put("columns",jsonArray);
            data.put("rows", avgTypeToday);
            return data;
        }

    public static Map getChargeDeail(List<Map> avgTypeToday, String name, String id) {
        String columns="[{\n" +
                "        \"name\":"+ "\""+name+"\",\n" +
                "        \"id\": "+"\""+id+"\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"总充电次数\",\n" +
                "        \"id\": \"charge_count\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"慢充\",\n" +
                "        \"id\": \"slow_charge_count\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"快充\",\n" +
                "        \"id\": \"fast_charge_count\"\n" +
                "      },\n" +
                "      {\n" +
                "        \"name\": \"深度充\",\n" +
                "        \"id\": \"fully_charge_count\"\n" +
                "      }]";
        JSONArray jsonArray = JSON.parseArray(columns);
        Map data = new HashMap();
        data.put("columns",jsonArray);
        data.put("rows", avgTypeToday);
        return data;
    }
}
